﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;

namespace CommonProject
{
    static class StaticCacheStore
    {
        private static IDictionary<string, object> _cache;
        private static object _sync ;
        static StaticCacheStore()
        {
            _cache=new Dictionary<string, object>();
            _sync=new object();
        }

        public static bool Exists<T>(string key)where T:class
        {
            Type t = typeof (T);
            lock (_sync)
            {
                return _cache.ContainsKey(t.Name + key);
            }
        }

        public static void Create<T>(string key,T data)
        {
            Type t = typeof (T);
            lock (_sync)
            {
                _cache.Add(key, data);    
            }
        }

    }
}
